<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>发货</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form id="my_form"  class="layui-form update_form" action="" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">订单编号</label>
				<div class="layui-input-block update_shurk">
					{$data.order_sn}
					<input type="hidden" name="id" value="{$data.id}" />
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">物流单号</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="shipping_code" lay-verify="required" placeholder="输入物流单号" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">物流公司</label>
				<div class="layui-input-block" style="float: left; margin-right: 20px; margin-left: 0;">
					<select name="shipping_name" id='shipping_name' lay-verify="required" lay-filter="sel_1">
						<option value="天天快递">天天快递</option>
						<option value="韵达快递">韵达快递</option>
						<option value="邮政小包">邮政小包</option>
						<option value="顺风速运">顺风速运</option>
						<option value="申通快递">申通快递</option>
						<option value="圆通速递">圆通速递</option>
						<option value="中通快递">中通快递</option>
						<option value="EMS">EMS</option>
						<option value="优速物流">优速物流</option>
						<option value="宅急送">宅急送</option>
						<option value="韵达快递">韵达快递</option>
						<option value="百世快递">百世快递</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item update_btnbox" style="text-align: center;margin-left:unset">
				<div class="layui-input-block" style="max-width: unset;float: unset;">
					<button  id='change_but' class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>
</html>
<script>
    //提交表单
	function set_content(){
  		 $.ajax({
             	type:"post",
                url:"{:url('shop/order_add')}",
                data: $('#my_form').serialize(),
                success:function(data){
                    if(data.code==200){
                    	layer.msg('发货成功', {
						  icon: 1,
						  time: 1500 
						}, function(){
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name);
					       	parent.layer.close(index); 
						});
                    }else{
                    	layer.msg('发货失败！');
                    }
                }
        });
  		
  	}
	
	
	//图片上传
	layui.use(['form',], function(){
  		var $ = layui.jquery,form = layui.form;
		form.on('submit(demo1)', function(data){
			$('#change_but').addClass("layui-btn-disabled");
			set_content();
			return false;
		});
	})
</script>
